package com.gustuy.service;

import com.gustuy.mapper.UserMapper;
import com.gustuy.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserMapperService implements UserMapper {
    private UserMapper mapper=null;
    @Autowired
    @Qualifier("sqlSession")
    private SqlSessionTemplate sqlsession=null;

    public UserMapperService(SqlSessionTemplate sqlsession){
        this.sqlsession=sqlsession;
        this.mapper=sqlsession.getMapper(UserMapper.class);
    }

    @Override
    public User getUserByUid(int Uid) {
        return mapper.getUserByUid(Uid);
    }

    @Override
    public List<User> getAllUser() {
        return mapper.getAllUser();
    }

    @Override
    public int addUser(User user) {
        return mapper.addUser(user);
    }

    @Override
    public int updateUser(User user) {
        return mapper.updateUser(user);
    }

    @Override
    public int deleteUser(int Uid) {
        return mapper.deleteUser(Uid);
    }
}
